import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '渠道编码',
    align:"center",
    dataIndex: 'customerTypeCode'
   },
   {
    title: '用户编码',
    align:"center",
    dataIndex: 'userCode'
   },
   {
    title: '用户名称',
    align:"center",
    dataIndex: 'userName'
   },
   {
    title: '电话',
    align:"center",
    dataIndex: 'phone'
   },
   {
    title: '用户账号',
    align:"center",
    dataIndex: 'userAccount_dictText'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
     {
      label: "用户编码",
      field: "userCode",
      component: 'Input', //TODO 范围查询
      //colProps: {span: 6},
	},
     {
      label: "用户名称",
      field: "userName",
      component: 'Input', //TODO 范围查询
      //colProps: {span: 6},
	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '渠道编码',
    field: 'customerTypeCode',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '用户编码',
    field: 'userCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入用户编码!'},
          ];
     },
  },
  {
    label: '用户名称',
    field: 'userName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入用户名称!'},
          ];
     },
  },
  {
    label: '电话',
    field: 'phone',
    component: 'Input',
  },
  {
    label: '用户账号',
    field: 'userAccount',
    component: 'JSelectUser',
    componentProps:{
      params: {isPurchaseUser: 1},
      isRadioSelection: true,
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  customerTypeCode: {title: '渠道编码',order: 0,view: 'text', type: 'string',},
  userCode: {title: '用户编码',order: 1,view: 'text', type: 'string',},
  userName: {title: '用户名称',order: 2,view: 'text', type: 'string',},
  phone: {title: '电话',order: 3,view: 'text', type: 'string',},
  userAccount: {title: '用户账号',order: 4,view: 'sel_user', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}